home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / esc.jar / com / extensibility / xml / XDRWriter$AttrProxy.class (.txt) < prev    next >
Encoding:
Java Class File  |  2000-06-30  |  3.8 KB  |  88 lines

  1. package com.extensibility.xml;
  2.  
  3. import com.extensibility.util.StringUtilities;
  4.  
  5. public class XDRWriter$AttrProxy extends XDRWriter.DeclProxy {
  6.    // $FF: synthetic field
  7.    final XDRWriter this$0;
  8.    AttributeDeclaration decl;
  9.  
  10.    XDRWriter$AttrProxy(XDRWriter var1) {
  11.       super(var1);
  12.       this.this$0 = var1;
  13.    }
  14.  
  15.    XDRWriter$AttrProxy(XDRWriter var1, AttributeDeclaration var2) {
  16.       super(var1);
  17.       this.this$0 = var1;
  18.       this.setDecl(var2);
  19.    }
  20.  
  21.    void setDecl(AttributeDeclaration var1) {
  22.       this.decl = var1;
  23.       super.setDecl(var1);
  24.    }
  25.  
  26.    public void write(SXE var1, boolean var2) {
  27.       if (!this.decl.isOwnerDeclared() || this.this$0.isPreviewing()) {
  28.          this.writeType(var1, var2);
  29.       }
  30.  
  31.    }
  32.  
  33.    void writeDataType(SXE var1) {
  34.       ((XDRWriter.DeclProxy)this).writeDataType(var1, this.decl.getDataType());
  35.    }
  36.  
  37.    void writeValues(SXE var1) {
  38.       if (this.decl.getDataType().isEnumeration() || this.decl.getDataType().isNotation()) {
  39.          var1.writeAttr(String.valueOf(this.this$0.getPrefix(1)).concat(String.valueOf("values")), this.this$0.schema.expandPERefs(StringUtilities.concat(this.decl.getChoices(this.decl.getSchema(), true), "", " ", ""), this.decl));
  40.       }
  41.    }
  42.  
  43.    void writeType(SXE var1, boolean var2) {
  44.       if (!this.decl.isReference()) {
  45.          var1.writeElem("AttributeType", -1);
  46.          var1.writeAttr("name", this.decl.getName());
  47.          this.writeDataType(var1);
  48.          this.writeValues(var1);
  49.          if (this.decl.getDefault() != null) {
  50.             var1.writeAttr("default", this.this$0.schema.expandPERefs(this.decl.getDefault(), this.decl));
  51.          }
  52.  
  53.          if (this.decl.getRequired()) {
  54.             var1.writeAttr("required", "yes");
  55.          }
  56.  
  57.          this.this$0.writeMetaProps(var1, this.decl.getMetaPropHash(), (BaseDeclaration)null);
  58.          if (var2) {
  59.             ((XDRWriter.DeclProxy)this).writeComments(var1);
  60.          }
  61.  
  62.          var1.flush("AttributeType");
  63.       }
  64.    }
  65.  
  66.    void writeRef(SXE var1, boolean var2) {
  67.       var1.writeElem("attribute", true);
  68.       var1.writeAttr("type", XDRWriter.access$2000171(this.this$0, this.decl.getName()));
  69.       AttributeDeclaration var3 = this.decl.getReferent(this.this$0.schema);
  70.       if (var3 != null) {
  71.          if ((var3.getDefault() == null != (this.decl.getDefault() == null) || var3.getDefault() != null && !var3.getDefault().equals(this.decl.getDefault())) && this.decl.getDefault() != null) {
  72.             var1.writeAttr("default", this.this$0.schema.expandPERefs(this.decl.getDefault(), this.decl));
  73.          }
  74.  
  75.          if (var3.getRequired() != this.decl.getRequired()) {
  76.             var1.writeAttr("required", this.decl.getRequired() ? "yes" : "no");
  77.          }
  78.  
  79.          this.this$0.writeMetaProps(var1, this.decl.getMetaPropHash(), var3);
  80.       }
  81.  
  82.       if (var2) {
  83.          ((XDRWriter.DeclProxy)this).writeComments(var1);
  84.       }
  85.  
  86.    }
  87. }
  88.